<template>
<view>
<!-- 详细机况弹窗 -->
<view class="mach_det" v-if="show_det!=0">
	<view class="mach_tit_box">
		<view class="m_ba_butt">
			<label @tap="canlce_det">返回</label>
		</view>
		<view class="mach_tit">机况详细描述表</view>
	</view>
	<view class="mach_item">
		<view class="mci_tit">驾驶室</view>
		<view class="mci_cont">
			<view>
				<label>是否有碰撞：</label>
				<label :class="'lab_item ' + (carInfo.cab_worn==0?'lai_cor':'')" data-name="cab_worn" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.cab_worn==1?'lai_cor':'')" data-name="cab_worn" data-id="1" @tap="click_item">轻微</label>
				<label :class="'lab_item ' + (carInfo.cab_worn==2?'lai_cor':'')" data-name="cab_worn" data-id="2" @tap="click_item">有</label>
			</view>
		</view>
	</view>
	<view class="mach_item">
		<view class="mci_tit">电动油门</view>
		<view class="mci_cont">
			<view>
				<label>是否正常：</label>
				<label :class="'lab_item ' + (carInfo.ele_gac==0?'lai_cor':'')" data-name="ele_gac" data-id="0" @tap="click_item">正常</label>
				<label :class="'lab_item ' + (carInfo.ele_gac==1?'lai_cor':'')" data-name="ele_gac" data-id="1" @tap="click_item">手拉</label>
			</view>
		</view>
	</view>
	<view class="mach_item">
		<view class="mci_tit">发动机是否有废气</view>
		<view class="mci_cont">
			<view>
				<label>上排气：</label>
				<label :class="'lab_item ' + (carInfo.enginewaste_on==0?'lai_cor':'')" data-name="enginewaste_on" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.enginewaste_on==1?'lai_cor':'')" data-name="enginewaste_on" data-id="1" @tap="click_item">轻微</label>
				<label :class="'lab_item ' + (carInfo.enginewaste_on==2?'lai_cor':'')" data-name="enginewaste_on" data-id="2" @tap="click_item">有</label>
			</view>
			<view>
				<label>下排气：</label>
				<label :class="'lab_item ' + (carInfo.enginewaste_down==0?'lai_cor':'')" data-name="enginewaste_down" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.enginewaste_down==1?'lai_cor':'')" data-name="enginewaste_down" data-id="1" @tap="click_item">轻微</label>
				<label :class="'lab_item ' + (carInfo.enginewaste_down==2?'lai_cor':'')" data-name="enginewaste_down" data-id="2" @tap="click_item">有</label>
			</view>
		</view>
	</view>
	<view class="mach_item">
		<view class="mci_tit">挂臂情况</view>
		<view class="mci_cont">
			<view>
				<label>大臂：</label>
				<label :class="'lab_item ' + (carInfo.fallarm_b==0?'lai_cor':'')" data-name="fallarm_b" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.fallarm_b==1?'lai_cor':'')" data-name="fallarm_b" data-id="1" @tap="click_item">轻微</label>
				<label :class="'lab_item ' + (carInfo.fallarm_b==2?'lai_cor':'')" data-name="fallarm_b" data-id="2" @tap="click_item">有</label>
			</view>
			<view>
				<label>小臂：</label>
				<label :class="'lab_item ' + (carInfo.fallarm_s==0?'lai_cor':'')" data-name="fallarm_s" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.fallarm_s==1?'lai_cor':'')" data-name="fallarm_s" data-id="1" @tap="click_item">轻微</label>
				<label :class="'lab_item ' + (carInfo.fallarm_s==2?'lai_cor':'')" data-name="fallarm_s" data-id="2" @tap="click_item">有</label>
			</view>
			<view>
				<label>铲斗：</label>
				<label :class="'lab_item ' + (carInfo.fallarm_c==0?'lai_cor':'')" data-name="fallarm_c" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.fallarm_c==1?'lai_cor':'')" data-name="fallarm_c" data-id="1" @tap="click_item">轻微</label>
				<label :class="'lab_item ' + (carInfo.fallarm_c==2?'lai_cor':'')" data-name="fallarm_c" data-id="2" @tap="click_item">有</label>
			</view>
		</view>
	</view>
	<view class="mach_item">
		<view class="mci_tit">转盘间隙情况</view>
		<view class="mci_cont">
			<view>
				<label>上下间隙：</label>
				<label :class="'lab_item ' + (carInfo.tablegap_sx==0?'lai_cor':'')" data-name="tablegap_sx" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.tablegap_sx==1?'lai_cor':'')" data-name="tablegap_sx" data-id="1" @tap="click_item">轻微</label>
				<label :class="'lab_item ' + (carInfo.tablegap_sx==2?'lai_cor':'')" data-name="tablegap_sx" data-id="2" @tap="click_item">有</label>
			</view>
			<view>
				<label>左右间隙：</label>
				<label :class="'lab_item ' + (carInfo.tablegap_zy==0?'lai_cor':'')" data-name="tablegap_zy" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.tablegap_zy==1?'lai_cor':'')" data-name="tablegap_zy" data-id="1" @tap="click_item">轻微</label>
				<label :class="'lab_item ' + (carInfo.tablegap_zy==2?'lai_cor':'')" data-name="tablegap_zy" data-id="2" @tap="click_item">有</label>
			</view>
		</view>
	</view>
	<view class="mach_item">
		<view class="mci_tit">怠速撑车情况</view>
		<view class="mci_cont">
			<view>
				<label>是否能撑车：</label>
				<label :class="'lab_item ' + (carInfo.brace_car==0?'lai_cor':'')" data-name="brace_car" data-id="0" @tap="click_item">正常</label>
				<label :class="'lab_item ' + (carInfo.brace_car==1?'lai_cor':'')" data-name="brace_car" data-id="1" @tap="click_item">撑不完全</label>
				<label :class="'lab_item ' + (carInfo.brace_car==2?'lai_cor':'')" data-name="brace_car" data-id="2" @tap="click_item">撑不起</label>
			</view>
		</view>
	</view>
	<view class="mach_item">
		<view class="mci_tit">单边行走情况</view>
		<view class="mci_cont">
			<view>
				<label>左边</label>
				<label :class="'lab_item ' + (carInfo.onewalk_z==0?'lai_cor':'')" data-name="onewalk_z" data-id="0" @tap="click_item">正常</label>
				<label :class="'lab_item ' + (carInfo.onewalk_z==1?'lai_cor':'')" data-name="onewalk_z" data-id="1" @tap="click_item">慢</label>
				<label :class="'lab_item ' + (carInfo.onewalk_z==2?'lai_cor':'')" data-name="onewalk_z" data-id="2" @tap="click_item">走不动</label>
			</view>
			<view>
				<label>右边</label>
				<label :class="'lab_item ' + (carInfo.onewalk_y==0?'lai_cor':'')" data-name="onewalk_y" data-id="0" @tap="click_item">正常</label>
				<label :class="'lab_item ' + (carInfo.onewalk_y==1?'lai_cor':'')" data-name="onewalk_y" data-id="1" @tap="click_item">慢</label>
				<label :class="'lab_item ' + (carInfo.onewalk_y==2?'lai_cor':'')" data-name="onewalk_y" data-id="2" @tap="click_item">走不动</label>
			</view>
		</view>
	</view>
	<view class="mach_item">
		<view class="mci_tit">行走时减速是否异常</view>
		<view class="mci_cont">
			<view>
				<label>左边</label>
				<label :class="'lab_item ' + (carInfo.walkslow_z==0?'lai_cor':'')" data-name="walkslow_z" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.walkslow_z==1?'lai_cor':'')" data-name="walkslow_z" data-id="1" @tap="click_item">有</label>
			</view>
			<view>
				<label>右边</label>
				<label :class="'lab_item ' + (carInfo.walkslow_y==0?'lai_cor':'')" data-name="walkslow_y" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.walkslow_y==1?'lai_cor':'')" data-name="walkslow_y" data-id="1" @tap="click_item">有</label>
			</view>
		</view>
	</view>
	<view class="mach_item">
		<view class="mci_tit">怠速憋车情况</view>
		<view class="mci_cont">
			<view>
				<label>是否正常：</label>
				<label :class="'lab_item ' + (carInfo.idling_holdcar==0?'lai_cor':'')" data-name="idling_holdcar" data-id="0" @tap="click_item">正常</label>
				<label :class="'lab_item ' + (carInfo.idling_holdcar==1?'lai_cor':'')" data-name="idling_holdcar" data-id="1" @tap="click_item">有烟</label>
				<label :class="'lab_item ' + (carInfo.idling_holdcar==2?'lai_cor':'')" data-name="idling_holdcar" data-id="2" @tap="click_item">熄火</label>
			</view>
		</view>
	</view>
	<view class="mach_item">
		<view class="mci_tit">憋车发动机烟量</view>
		<view class="mci_cont">
			<view>
				<label>大油门：</label>
				<label :class="'lab_item ' + (carInfo.holdsmoke_b==0?'lai_cor':'')" data-name="holdsmoke_b" data-id="0" @tap="click_item">正常</label>
				<label :class="'lab_item ' + (carInfo.holdsmoke_b==1?'lai_cor':'')" data-name="holdsmoke_b" data-id="1" @tap="click_item">量小</label>
				<label :class="'lab_item ' + (carInfo.holdsmoke_b==2?'lai_cor':'')" data-name="holdsmoke_b" data-id="2" @tap="click_item">量大</label>
			</view>
			<view>
				<label>小油门：</label>
				<label :class="'lab_item ' + (carInfo.holdsmoke_s==0?'lai_cor':'')" data-name="holdsmoke_s" data-id="0" @tap="click_item">正常</label>
				<label :class="'lab_item ' + (carInfo.holdsmoke_s==1?'lai_cor':'')" data-name="holdsmoke_s" data-id="1" @tap="click_item">量小</label>
				<label :class="'lab_item ' + (carInfo.holdsmoke_s==2?'lai_cor':'')" data-name="holdsmoke_s" data-id="2" @tap="click_item">量大</label>
			</view>
		</view>
	</view>
	<view class="mach_item">
		<view class="mci_tit">设备速度情况</view>
		<view class="mci_cont">
			<view>
				<label>是否正常：</label>
				<label :class="'lab_item ' + (carInfo.device_speed==0?'lai_cor':'')" data-name="device_speed" data-id="0" @tap="click_item">快</label>
				<label :class="'lab_item ' + (carInfo.device_speed==1?'lai_cor':'')" data-name="device_speed" data-id="1" @tap="click_item">慢</label>
				<label :class="'lab_item ' + (carInfo.device_speed==2?'lai_cor':'')" data-name="device_speed" data-id="2" @tap="click_item">无动作</label>
			</view>
		</view>
	</view>
	<view class="mach_item">
		<view class="mci_tit">开裂情况</view>
		<view class="mci_cont">
			<view>
				<label>大臂：</label>
				<label :class="'lab_item ' + (carInfo.crack_b==0?'lai_cor':'')" data-name="crack_b" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.crack_b==1?'lai_cor':'')" data-name="crack_b" data-id="1" @tap="click_item">有</label>
			</view>
			<view>
				<label>小臂：</label>
				<label :class="'lab_item ' + (carInfo.crack_s==0?'lai_cor':'')" data-name="crack_s" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.crack_s==1?'lai_cor':'')" data-name="crack_s" data-id="1" @tap="click_item">有</label>
			</view>
			<view>
				<label>铲斗：</label>
				<label :class="'lab_item ' + (carInfo.crack_c==0?'lai_cor':'')" data-name="crack_c" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.crack_c==1?'lai_cor':'')" data-name="crack_c" data-id="1" @tap="click_item">有</label>
			</view>
		</view>
	</view>
	<view class="mach_item">
		<view class="mci_tit">设备运行大件是否有异响</view>
		<view class="mci_cont">
			<view>
				<label>发动机：</label>
				<label :class="'lab_item ' + (carInfo.runbig_fdj==0?'lai_cor':'')" data-name="runbig_fdj" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.runbig_fdj==1?'lai_cor':'')" data-name="runbig_fdj" data-id="1" @tap="click_item">有</label>
			</view>
			<view>
				<label>主阀：</label>
				<label :class="'lab_item ' + (carInfo.runbig_zf==0?'lai_cor':'')" data-name="runbig_zf" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.runbig_zf==1?'lai_cor':'')" data-name="runbig_zf" data-id="1" @tap="click_item">有</label>
			</view>
			<view>
				<label>回转马达：</label>
				<label :class="'lab_item ' + (carInfo.runbig_hzmd==0?'lai_cor':'')" data-name="runbig_hzmd" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.runbig_hzmd==1?'lai_cor':'')" data-name="runbig_hzmd" data-id="1" @tap="click_item">有</label>
			</view>
		</view>
	</view>
	<view class="mach_item">
		<view class="mci_tit">链轨链桶情况</view>
		<view class="mci_cont">
			<view>
				<label>左链接</label>
				<label :class="'lab_item ' + (carInfo.chain_z==0?'lai_cor':'')" data-name="chain_z" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.chain_z==1?'lai_cor':'')" data-name="chain_z" data-id="1" @tap="click_item">有</label>
			</view>
			<view>
				<label>右链接</label>
				<label :class="'lab_item ' + (carInfo.chain_y==0?'lai_cor':'')" data-name="chain_y" data-id="0" @tap="click_item">无</label>
				<label :class="'lab_item ' + (carInfo.chain_y==1?'lai_cor':'')" data-name="chain_y" data-id="1" @tap="click_item">有</label>
			</view>
		</view>
	</view>
	<view class="mach_item">
		<view class="mci_tit">X架情况</view>
		<view class="mci_cont">
			<view>
				<label>是否正常：</label>
				<label :class="'lab_item ' + (carInfo.x_frame==0?'lai_cor':'')" data-name="x_frame" data-id="0" @tap="click_item">正常</label>
				<label :class="'lab_item ' + (carInfo.x_frame==1?'lai_cor':'')" data-name="x_frame" data-id="1" @tap="click_item">有开裂</label>
				<label :class="'lab_item ' + (carInfo.x_frame==2?'lai_cor':'')" data-name="x_frame" data-id="2" @tap="click_item">需更换</label>
			</view>
		</view>
	</view>
	<view class="mach_item">
		<view class="mci_tit">锤及管路</view>
		<view class="mci_cont">
			<view>
				<label>锤：</label>
				<label :class="'lab_item ' + (carInfo.mace==0?'lai_cor':'')" data-name="mace" data-id="0" @tap="click_item">带</label>
				<label :class="'lab_item ' + (carInfo.mace==1?'lai_cor':'')" data-name="mace" data-id="1" @tap="click_item">需拆</label>
				<label :class="'lab_item ' + (carInfo.mace==2?'lai_cor':'')" data-name="mace" data-id="2" @tap="click_item">无</label>
			</view>
			<view>
				<label>管路：</label>
				<label :class="'lab_item ' + (carInfo.tube==0?'lai_cor':'')" data-name="tube" data-id="0" @tap="click_item">带</label>
				<label :class="'lab_item ' + (carInfo.tube==1?'lai_cor':'')" data-name="tube" data-id="1" @tap="click_item">需拆</label>
				<label :class="'lab_item ' + (carInfo.tube==2?'lai_cor':'')" data-name="tube" data-id="2" @tap="click_item">无</label>
			</view>
		</view>
	</view>
	<view class="mach_item">
		<view class="mci_tit">手续情况</view>
		<view class="mci_cont">
			<view>
				<label>发票：</label>
				<label :class="'lab_item ' + (carInfo.routine_fp==0?'lai_cor':'')" data-name="routine_fp" data-id="0" @tap="click_item">有</label>
				<label :class="'lab_item ' + (carInfo.routine_fp==1?'lai_cor':'')" data-name="routine_fp" data-id="1" @tap="click_item">无</label>
			</view>
			<view>
				<label>合格证：</label>
				<label :class="'lab_item ' + (carInfo.routine_hgz==0?'lai_cor':'')" data-name="routine_hgz" data-id="0" @tap="click_item">有</label>
				<label :class="'lab_item ' + (carInfo.routine_hgz==1?'lai_cor':'')" data-name="routine_hgz" data-id="1" @tap="click_item">无</label>
			</view>
		</view>
	</view>
	<view class="mach_butt">
		<button class="mc_bu" @tap="canlce_det">确定</button>
	</view>
</view>
<view class="s_top_box">发布{{c_name}}</view>
<block v-if="classid==46">
	<form @reset="formReset" @submit="release" reportSubmit="true">
		<view class="modle" style="border-bottom:0">
			车辆详图
		</view>
		<view v-for="(item, index) in carsimgs" :key="index" class="shangchuan_view" v-if="item.img!=''">
			<image @tap="upthiscarsimgs" class="shangchuan_Img_close" :data-index="index" src="/static/pages/image/tupiangb_btn.png"></image>
			<image @tap="showimgs" class="shangchuan_Img" :data-index="index" :src="item.img"></image>
		</view>
		<view class="shangchuan_view" v-if="carsimgs.length<=50">
			<image @tap="upcarsimgs" class="shangchuan_Img" src="/static/pages/image/tianjiantp_btn.png"></image>
		</view>

		<!-- <view class="modle">
			车辆简介
			<input class="modle_right" name="synopsis" placeholder="请输入车辆介绍" placeholderStyle="color: #9295A8;" type="text" value="{{defult_value}}"></input>
		</view> -->
		<!-- <view class="modle">
			发布类型
			<text class="must_red">*</text>
			<picker bindchange="selectclass" class="modle_right" range="{{classes}}" rangeKey="name" value="{{index}}">
				<view>
					{{selectclass}}
				</view>
			</picker>
		</view> -->
		<!-- <view bindtap="selectbrand" class="modle">
			车辆品牌
			<text class="must_red">*</text>
			<view class="modle_right">
				{{selectbrand}}
			</view>
		</view> -->
		<view class="modle" style="display:none;">
			出售设备介绍
			<text class="must_red">*</text>
			<input class="modle_right" name="carname" placeholder="请输入设备详情介绍" placeholderStyle="color: #9295A8;" type="text" :value="brandname">
		</view>


		<view class="modle">
			汽车名称
			<text class="must_red">*</text>
			<input class="modle_right" name="carname" placeholder="请输入汽车名称" placeholderStyle="color: #9295A8;" type="text" :value="defult_value">
		</view>
		<!-- <view class="modle">
			工作时长
			<text class="must_red">*</text>
			<input class="modle_right" name="work_hours" placeholder="请输入时长单位：小时" placeholderStyle="color: #9295A8;" type="number" value="{{work_hours}}"></input>
		</view> -->
		<!-- <view class="modle">
			重量
			<text class="must_red">*</text>
			<input class="modle_right" name="weight" placeholder="请输入重量单位：吨" placeholderStyle="color: #9295A8;" type="number" value="{{weight}}"></input>
		</view> -->
		<view class="modle" style="display:none;">
			出厂年限
			<text class="must_red">*</text>
			<input class="modle_right" name="agelimit" placeholder="请输入年限单位：年" placeholderStyle="color: #9295A8;" type="number" :value="agelimit">
		</view>
		<!-- <view class="modle">
			生产日期
			<text class="must_red">*</text>
			<picker bindchange="bindDateChange" class="modle_right" fields="day" mode="date" value="{{date}}">
				<view>
					{{selecttime}}
				</view>
			</picker>
		</view> -->
		<view class="modle">
			设备购买日期
			<text class="must_red">*</text>
			<picker @change="bindDateChange1" class="modle_right" fields="day" mode="date" :value="date">
				<view>
					{{buydate}}
				</view>
			</picker>
		</view>
		<!-- <view class="modle">
			公里数(单位万)
			<text class="must_red">*</text>
			<input class="modle_right" name="kilometre" placeholder="请输入公里数单位：万" placeholderStyle="color: #9295A8;" style="width:350rpx;" type="digit" value="{{defult_value}}"></input>
		</view> -->
		<view class="modle">
			售价(单位万)
			<text class="must_red">*</text>
			<input class="modle_right" name="price" placeholder="请输入转让价格单位：万" placeholderStyle="color: #9295A8;" style="width:350rpx;" type="digit" :value="defult_value">
		</view>
		<view class="modle">
			排气量
			<text class="must_red">*</text>
			<input class="modle_right" name="exhaust" placeholder="请输入排气量（如：1.6）T" placeholderStyle="color: #9295A8;" style="width:350rpx;" :value="defult_value">
		</view>
		<!-- <view class="modle">
			变速箱
			<text class="must_red">*</text>
			<picker bindchange="gearbox" class="modle_right" mode="selector" range="{{gearboxes}}" rangeKey="name" value="{{index}}">
				<view>
					{{gearboxname}}
				</view>
			</picker>
		</view> -->
		<!-- <view class="modle">
			是否有发票、合格证
			备注
			<text class="must_red">*</text>
			<input class="modle_right" name="labstr" placeholder="标签使用','隔开" placeholderStyle="color: #9295A8;" style="width:350rpx;" value="{{labstr}}"></input>
			备注
			<view class="f_h_box">
				<view class="fh_item">
					<view class="fh_img" bindtap="choose_fp">
						<block wx:if="{{has_invoice==1}}">
							<image mode="aspectFill" src="../image/xuanze_btn.png"></image>
						</block>

						<block wx:if="{{has_invoice==0}}">
							<image mode="aspectFill" src="../image/weixuanze_btn.png"></image>
						</block>
					</view>
					<view class="fh_word">发票</view>
				</view>
				<view class="fh_item">
					<view class="fh_img" bindtap="choose_hgz">
						<block wx:if="{{has_certificate==1}}">
							<image mode="aspectFill" src="../image/xuanze_btn.png"></image>
						</block>

						<block wx:if="{{has_certificate==0}}">
							<image mode="aspectFill" src="../image/weixuanze_btn.png"></image>
						</block>
					</view>
					<view class="fh_word">合格证</view>
				</view>
			</view>
		</view> -->



		<view class="modle">
			联系人
			<text class="must_red">*</text>
			<input class="modle_right" name="relname" placeholder="请输入联系人" placeholderStyle="color: #9295A8;" style="width:350rpx;" :value="relname">
		</view>
		<view class="modle">
			<input class="modle_right btm_input" name="phone" placeholder="授权获取电话" placeholderStyle="color: #9295A8;" type="number" :value="userphone">
			联系电话
			<text class="must_red">*</text>
			<button @getphonenumber="getPhoneNumber" class="modle_btn" open-type="getPhoneNumber">电话授权</button>
		</view>
		<view class="modle">
			<input class="modle_right btm_input" disabled="true" name="address" placeholder placeholderStyle="color: #9295A8;" type="text" :value="mapname&&mapname.length>2?mapname:''">
			车辆地址
			<text class="must_red">*</text>
			<button @tap="tomap" class="modle_btn">获取位置</button>
		</view>
		<!-- <view class="modle">
			机况详情设置
			<text class="must_red">*</text>
			<text class="modle_right" bindtap="toMore">设置机况详情</text>
		</view> -->
		<view class="modle" style="border-bottom:0">
			车辆视频
		</view>
		<view class="shangchuan_view" v-if="video!=''">
			<!-- <image class="shangchuan_Img_close" src="/pages/image/tupiangb_btn.png"></image> -->
			<button class="del_butt" @tap="delVid">删除</button>
			<!-- <image class="shangchuan_Img" src="{{video}}"></image> -->
			<video class="shangchuan_Img" :src="video.video"></video>
		</view>
		<view class="shangchuan_view" v-if="video==''">
			<image @tap="chooseVideo" class="shangchuan_Img" src="/static/pages/image/tianjiantp_btn.png"></image>
		</view>
		<button class="bufa_btn" style="background: #333;" v-if="status=='1'">已经禁止发布车辆信息</button>
		<button class="bufa_btn" form-type="submit" v-else>发布</button>
		<view class="jinggao">发布不真实车源，虚报价格，一经核查将做封号处理。</view>
	</form>
</block>
<block v-if="classid!=46">
	<form @reset="formReset" @submit="release" reportSubmit="true">
		<view class="modle" style="border-bottom:0">
			车辆详图
		</view>
		<view v-for="(item, index) in carsimgs" :key="index" class="shangchuan_view" v-if="item.img!=''">
			<image @tap="upthiscarsimgs" class="shangchuan_Img_close" :data-index="index" src="/static/pages/image/tupiangb_btn.png"></image>
			<image @tap="showimgs" class="shangchuan_Img" :data-index="index" :src="item.img"></image>
		</view>
		<view class="shangchuan_view" v-if="carsimgs.length<=50">
			<image @tap="upcarsimgs" class="shangchuan_Img" src="/static/pages/image/tianjiantp_btn.png"></image>
		</view>

		<!-- <view class="modle">
			车辆简介
			<input class="modle_right" name="synopsis" placeholder="请输入车辆介绍" placeholderStyle="color: #9295A8;" type="text" value="{{defult_value}}"></input>
		</view> -->
		<!-- <view class="modle">
			发布类型
			<text class="must_red">*</text>
			<picker bindchange="selectclass" class="modle_right" range="{{classes}}" rangeKey="name" value="{{index}}">
				<view>
					{{selectclass}}
				</view>
			</picker>
		</view> -->
		<!-- <view bindtap="selectbrand" class="modle">
			车辆品牌
			<text class="must_red">*</text>
			<view class="modle_right">
				{{selectbrand}}
			</view>
		</view> -->
		<view class="modle" style="display:none;">
			出售设备介绍
			<text class="must_red">*</text>
			<input class="modle_right" name="car_type" placeholder="请输入出售设备介绍" placeholderStyle="color: #9295A8;" type="text" :value="defult_value">
		</view>

		<view class="modle">
			出售设备介绍
			<text class="must_red">*</text>
			<input class="modle_right" name="carname" placeholder="请输入设备详情介绍" placeholderStyle="color: #9295A8;" type="text" :value="defult_value">
		</view>


		<!-- <view class="modle">
			工作时间
			<text class="must_red">*</text>
			<input class="modle_right" name="work_hours" placeholder="请输入时间单位：小时" placeholderStyle="color: #9295A8;" type="number" value="{{work_hours}}"></input>
		</view> -->
		<!-- <view class="modle">
			重量
			<text class="must_red">*</text>
			<input class="modle_right" name="weight" placeholder="请输入重量单位：吨" placeholderStyle="color: #9295A8;" type="number" value="{{weight}}"></input>
		</view> -->
		<view class="modle" style="display:none;">
			出厂年限
			<text class="must_red">*</text>
			<input class="modle_right" name="agelimit" placeholder="请输入年限单位：年" placeholderStyle="color: #9295A8;" type="number" :value="agelimit">
		</view>
		<!-- <view class="modle">
			生产日期
			<text class="must_red">*</text>
			<picker bindchange="bindDateChange" class="modle_right" fields="day" mode="date" value="{{date}}">
				<view>
					{{selecttime}}
				</view>
			</picker>
		</view> -->
		<view class="modle">
			设备购买日期
			<text class="must_red">*</text>
			<picker @change="bindDateChange1" class="modle_right" fields="day" mode="date" :value="date">
				<view>
					{{buydate}}
				</view>
			</picker>
		</view>
		<!-- <view class="modle">
			公里数(单位万)
			<text class="must_red">*</text>
			<input class="modle_right" name="kilometre" placeholder="请输入公里数单位：万" placeholderStyle="color: #9295A8;" style="width:350rpx;" type="digit" value="{{defult_value}}"></input>
		</view> -->
		<view class="modle">
			销售价钱(单位万)
			<text class="must_red">*</text>
			<input class="modle_right" name="price" placeholder="请输入销售价钱单位：万" placeholderStyle="color: #9295A8;" style="width:350rpx;" type="digit" :value="defult_value">
		</view>
		<!-- <view class="modle">
			排气量
			<text class="must_red">*</text>
			<input class="modle_right" name="exhaust" placeholder="请输入排气量（如：1.6）T" placeholderStyle="color: #9295A8;" style="width:350rpx;" value="{{defult_value}}"></input>
		</view>
		<view class="modle">
			变速箱
			<text class="must_red">*</text>
			<picker bindchange="gearbox" class="modle_right" mode="selector" range="{{gearboxes}}" rangeKey="name" value="{{index}}">
				<view>
					{{gearboxname}}
				</view>
			</picker>
		</view>-->
		<!-- <view class="modle">
			是否有发票、合格证
			备注
			<text class="must_red">*</text> 
			<input class="modle_right" name="labstr" placeholder="标签使用','隔开" placeholderStyle="color: #9295A8;" style="width:350rpx;" value="{{labstr}}"></input>
			备注
			<view class="f_h_box">
				<view class="fh_item">
					<view class="fh_img" bindtap="choose_fp">
						<block wx:if="{{has_invoice==1}}">
							<image mode="aspectFill" src="../image/xuanze_btn.png"></image>
						</block>

						<block wx:if="{{has_invoice==0}}">
							<image mode="aspectFill" src="../image/weixuanze_btn.png"></image>
						</block>
					</view>
					<view class="fh_word">发票</view>
				</view>
				<view class="fh_item">
					<view class="fh_img" bindtap="choose_hgz">
						<block wx:if="{{has_certificate==1}}">
							<image mode="aspectFill" src="../image/xuanze_btn.png"></image>
						</block>

						<block wx:if="{{has_certificate==0}}">
							<image mode="aspectFill" src="../image/weixuanze_btn.png"></image>
						</block>
					</view>
					<view class="fh_word">合格证</view>
				</view>
			</view>
		</view> -->
		<view class="modle">
			机主姓名
			<text class="must_red">*</text>
			<input class="modle_right" name="relname" placeholder="请输入机主姓名" placeholderStyle="color: #9295A8;" style="width:350rpx;" :value="relname">
		</view>
		<view class="modle">
			<input class="modle_right btm_input" name="phone" placeholder="授权获取电话" placeholderStyle="color: #9295A8;" type="number" :value="userphone">
			联系电话
			<text class="must_red">*</text>
			<button @getphonenumber="getPhoneNumber" class="modle_btn" open-type="getPhoneNumber">电话授权</button>
		</view>
		<view class="modle">
			<input class="modle_right btm_input" disabled="true" name="address" placeholder placeholderStyle="color: #9295A8;" type="text" :value="mapname&&mapname.length>2?mapname:''">
			车辆地址
			<text class="must_red">*</text>
			<button @tap="tomap" class="modle_btn">获取位置</button>
		</view>
		<!-- <view class="modle">
			车辆详情设置
			<text class="must_red">*</text>
			<text class="modle_right" bindtap="toMore">设置车辆详情</text>
		</view> -->
		<view class="modle" style="border-bottom:0">
			车辆视频
		</view>
		<view class="shangchuan_view" v-if="video!=''">
			<!-- <image class="shangchuan_Img_close" src="/pages/image/tupiangb_btn.png"></image> -->
			<button class="del_butt" @tap="delVid">删除</button>
			<!-- <image class="shangchuan_Img" src="{{video}}"></image> -->
			<video class="shangchuan_Img" :src="video.video"></video>
		</view>
		<view class="shangchuan_view" v-if="video==''">
			<image @tap="chooseVideo" class="shangchuan_Img" src="/static/pages/image/tianjiantp_btn.png"></image>
		</view>
		<button class="bufa_btn" style="background: #333;" v-if="status=='1'">已经禁止发布车辆信息</button>
		<button class="bufa_btn" form-type="submit" v-else>发布</button>
		<view class="jinggao">发布不真实车源，虚报价格，一经核查将做封号处理。</view>
	</form>
</block>
<!--<import src="/pages/alert/index.wxml"></import>-->
<block data-type="template" data-is="alert" data-attr="isShow:isShow">
    <view class="wx_dialog_container" :hidden="!isShow">
        <view class="wx-alert-mask"></view>
        <view class="wx-alert-dialog">
            <view class="wx-alert-dialog-title">尊敬的用户</view>
            <view class="wx-alert-dialog-content">尚未获取到您的用户信息，较多功能无法体验，请允许获取用户信息</view>
            <view class="wx-alert-dialog-footer">
                <button @tap="hideDialog" class="wx-alert-dialog-btn">拒绝</button>
                <button @getuserinfo="updateUserInfo" class="wx-alert-dialog-btn" open-type="getUserInfo">允许</button>
            </view>
        </view>
    </view>
</block>
</view>
</template>

<script>
var app = getApp(),
    upurl = app.globalData.util.url("entry/wxapp/Api", {
  m: "monai_market",
  uid: wx.getStorageSync("uid"),
  r: "Upimg"
});

export default {
  data() {
    return {
      upcarindex: 0,
      date: "2017-01",
      //有无发票
      has_invoice: 0,
      //有无合格证
      has_certificate: 0,
      carsimgs: [{
        img: "",
        intro: "",
        imgshort: ""
      }],
      brandid: "",
      brandname: "",
      classid: "",
      classes: [],
      brands: [],
      selectclass: "请选择分类",
      selectbrand: "请选择品牌",
      selecttime: " 请选择生产日期",
      selecttime1: "",
      buydate: '请选择购买日期',
      buydate1: '',
      vehicletime: "请选择上牌日期",
      vehicletime1: "",
      insurance: "请选择保险到期时间",
      insurance1: "",
      gearboxes: [{
        name: "手自一体",
        id: "1"
      }, {
        name: "手动档",
        id: "2"
      }, {
        name: "自动挡",
        id: "3"
      }],
      gearboxname: "请选择变速箱类型",
      gearboxindex: 0,
      userphone: "",
      mapname: "",
      mapx: "",
      mapy: "",
      carimgs: [],
      buttscan: !1,
      notice: [],
      noticeindex: 0,
      textareatype: !1,
      textareaname: "请输入车辆信息介绍",
      textareainput: "",
      isShow: !1,
      showtextarea: !1,
      status: "",
      show_det: 0,
      cab_worn: 0,
      carInfo: {
        cab_worn: 0,
        ele_gac: 0,
        enginewaste_on: 0,
        enginewaste_down: 0,
        fallarm_b: 0,
        fallarm_s: 0,
        fallarm_c: 0,
        tablegap_sx: 0,
        tablegap_zy: 0,
        brace_car: 0,
        onewalk_z: 0,
        onewalk_y: 0,
        walkslow_z: 0,
        walkslow_y: 0,
        idling_holdcar: 0,
        holdsmoke_b: 0,
        holdsmoke_s: 0,
        device_speed: 0,
        crack_b: 0,
        crack_s: 0,
        crack_c: 0,
        runbig_fdj: 0,
        runbig_zf: 0,
        runbig_hzmd: 0,
        chain_z: 0,
        chain_y: 0,
        x_frame: 0,
        mace: 0,
        tube: 0,
        routine_fp: 0,
        routine_hgz: 0,
        relname: ''
      },
      relname: '',
      label: [],
      labstr: '',
      video: '',
      province: '',
      city: '',
      // 市
      district: '',
      // 	区
      work_hours: '',
      // 工作时长
      weight: '',
      //  重量（吨）
      agelimit: '',
      // 出厂年限
      src: '',
      //发布的类型的id
      //发布的类型的名称
      c_name: '',
      defult_value: "",
      maxwidth: "",
      maxheight: ""
    };
  },

  components: {},
  props: {},
  onShow: function () {
    var a = this;
    "" != a.brandid && "" != a.brandname && a.setData({
      selectbrand: a.brandname
    });
  },
  onLoad: function (a) {
    var t = this,
        cid = a.cid,
        name = a.name;
    console.log('url参数：', cid + '+++' + name);
    t.setData({
      classid: cid,
      c_name: name
    });
    app.globalData.util.getUserInfo(function (a) {
      a.memberInfo || t.setData({
        isShow: !0
      }), app.globalData.util.request({
        url: "entry/wxapp/Api",
        data: {
          m: "monai_market",
          r: "me.info",
          uid: wx.getStorageSync("uid")
        },
        success: function (a) {
          console.log(a), 1 == a.data.data.status && wx.showModal({
            title: "提示",
            content: "您的用户已经禁止发布车辆信息，请联系管理员处理",
            showCancel: !1,
            success: function (a) {}
          }), t.setData({
            status: a.data.data.status
          });
        }
      });
    }), t.firstin(t);
  },
  onReady: function () {},
  onHide: function () {},
  onUnload: function () {},
  onPullDownRefresh: function () {},
  onReachBottom: function () {},
  onShareAppMessage: function () {},
  methods: {
    intextarea: function () {
      this.setData({
        textareatype: !0,
        textareaname: this.textareainput
      });
    },
    bindblur: function (a) {
      console.log(a.detail.value);
      var t = a.detail.value,
          e = t;
      t || (t = "请输入车辆信息介绍", e = ""), this.setData({
        textareatype: !1,
        textareaname: t,
        textareainput: e
      });
    },
    bindconfirm: function () {
      var a = new Date();
      console.log(a.getMilliseconds());
    },
    hideDialog: function () {
      this.setData({
        isShow: !this.isShow
      });
    },
    updateUserInfo: function (a) {
      var t = this;
      app.globalData.util.getUserInfo(function (a) {
        wx.setStorageSync("uid", a.memberInfo.uid), t.hideDialog();
      }, a.detail);
    },
    showtextareaFun: function () {
      var a = this;
      console.log(!a.showtextarea), a.setData({
        showtextarea: !a.showtextarea
      });
    },
    textareashow: function (a) {
      this.setData({
        mapname: a.detail.value
      });
    },
    firstin: function (e) {
      var a = wx.getSystemInfoSync();
      e.setData({
        maxwidth: a.windowWidth,
        maxheight: a.windowHeight
      }), app.globalData.util.request({
        url: "entry/wxapp/Api",
        data: {
          m: "monai_market",
          uid: app.globalData.getuid(),
          r: "sale.index.saleindex"
        },
        cachetime: "0",
        success: function (a) {
          var t = {
            classes: a.data.data.class,
            userphone: "",
            mapname: ""
          };
          a.data.data.user && (t.userphone = a.data.data.user.phone, t.mapname = a.data.data.user.address), e.setData(t);
        }
      });
    },
    //获取设置机况数据
    click_item: function (e) {
      var name = e.currentTarget.dataset.name;
      var id = e.currentTarget.dataset.id;
      var that = this; // if(name=='cab_worn'){
      //     that.setData({
      //         cab_worn:parseInt(id)
      //     });
      // }

      var jsonCar = that.carInfo;
      jsonCar[name] = parseInt(id);
      that.carInfo[name] = parseInt(id);
      that.setData({
        carInfo: jsonCar
      });
      console.log(that.carInfo);
    },
    //设置更多机况
    toMore: function () {
      var that = this;
      that.setData({
        show_det: 1
      });
    },
    //关闭更多机况详情
    canlce_det: function () {
      var that = this;
      console.log(that.carInfo);
      that.setData({
        show_det: 0
      });
    },
    selectclassFun: function (a) {
      var t = this.classes[a.detail.value];
      t && this.setData({
        selectclass: t.name,
        classid: t.id
      });
    },
    gearbox: function (a) {
      var t = this.gearboxes[a.detail.value];
      t && this.setData({
        gearboxname: t.name,
        gearboxindex: a.detail.value
      });
    },
    selectbrandFun: function (a) {
      wx.navigateTo({
        url: "/pages/selectscards/index"
      });
    },
    bindDateChange: function (a) {
      console.log(a.detail.value);
      var t = a.detail.value.split("-");
      this.setData({
        selecttime: t[0] + "年" + t[1] + "月" + t[2] + '日',
        selecttime1: a.detail.value
      });
    },
    bindDateChange1: function (a) {
      console.log(a.detail.value);
      var t = a.detail.value.split("-");
	  console.log(t);
      this.setData({
        buydate: t[0] + "年" + t[1] + "月" + t[2] + '日',
        buydate1: a.detail.value
      });
    },
    insuranceFun: function (a) {
      console.log(a.detail.value);
      var t = a.detail.value.split("-");
      this.setData({
        insurance: t[0] + "年" + t[1] + "月" + t[2] + "日",
        insurance1: a.detail.value
      });
    },
    vehicletimeFun: function (a) {
      console.log(a.detail.value);
      var t = a.detail.value.split("-");
      this.setData({
        vehicletime: t[0] + "年" + t[1] + "月" + t[2] + "日",
        vehicletime1: a.detail.value
      });
    },
    getPhoneNumber: function (a) {
      console.log(a);
      var t = this;
      app.globalData.util.request({
        url: "entry/wxapp/Api",
        data: {
          r: "sale.index.userphone",
          m: "monai_market",
          iv: a.detail.iv,
          encryptedData: a.detail.encryptedData
        },
        cachetime: "0",
        success: function (a) {
          t.setData({
            userphone: a.data.data
          });
        }
      });
    },
    tomap: function () {
      var t = this;
      wx.chooseLocation({
        success: function (a) {
          console.log(a), t.setData({
            mapx: a.latitude,
            mapy: a.longitude,
            mapname: a.address
          });
        },
        fail: function () {
          wx.getSetting({
            success: function (a) {
              a.authSetting["scope.userLocation"] || wx.showModal({
                content: "请允许获取地理位置后再次尝试",
                success: function (a) {
                  a.confirm ? wx.openSetting({
                    success: function (a) {
                      a.authSetting = {
                        "scope.userInfo": !0,
                        "scope.userLocation": !0
                      };
                    },
                    fail: function (a) {
                      console.log(a);
                    }
                  }) : a.cancel && console.log("用户点击取消");
                }
              });
            }
          });
        }
      });
    },
    //选择视频
    chooseVideo: function () {
      var that = this;
      wx.chooseVideo({
        success: function (res) {
          console.log(res.tempFilePath);
          that.setData({
            src: res.tempFilePath
          }), that.uploadvideo();
        }
      });
    },
    //上传视频 目前后台限制最大100M，以后如果视频太大可以在选择视频的时候进行压缩
    uploadvideo: function () {
      var that = this;
      var src = that.src;
      var f = app.globalData.util.url("entry/wxapp/Api", {
        m: "monai_market",
        r: "sale.index.file_upload1"
      });
      wx.uploadFile({
        url: f,
        //服务器接口
        filePath: src,
        //   header: {
        //     'content-type': 'multipart/form-data'
        //   },
        name: 'file',
        //服务器定义的Key值
        success: function (res) {
          console.log('视频上传成功', JSON.parse(res.data));
          that.setData({
            video: JSON.parse(res.data).data
          });
        },
        fail: function () {
          console.log('接口调用失败');
        }
      });
    },
    //删除视频
    delVid: function () {
      var that = this;
      that.setData({
        video: ''
      });
    },
    //选择有无发票
    choose_fp: function () {
      var that = this;

      if (that.has_invoice == 0) {
        that.setData({
          has_invoice: 1
        });
      } else {
        that.setData({
          has_invoice: 0
        });
      }
    },
    //选择有无合格证
    choose_hgz: function () {
      var that = this;

      if (that.has_certificate == 0) {
        that.setData({
          has_certificate: 1
        });
      } else {
        that.setData({
          has_certificate: 0
        });
      }
    },
    release: function (a) {
      var t = this,
          e = wx.getStorageSync("uid");

      if (console.log(a.detail.value.address), e) {
        // var lab = a.detail.value.labstr.replace(/，/ig, ',');
        // var labarr = lab.split(',');
        // console.log(lab.split(','));
        t.setData({
          buttscan: !0
        });
        var i = t.classid;

        if (i == 46) {
          // if ("" == i || "undefined" == i || "请选择车辆类型" == i) return app.util.message({
          //     title: "请选择车辆类型",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });
          // var s = t.data.brandid;
          var s = a.detail.value.car_type; // if ("" == s || "undefined" == s || "请输入车辆品牌" == s) return app.util.message({
          //     title: "请输入车辆品牌",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });

          var n = t.selecttime1; // if ("请选择生产日期" == n || "undefined" == n || "" == t.data.selecttime1) return app.util.message({
          //     title: "请选择生产日期",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });

          var r = a.detail.value.carname; // if ("" == r || "undefined" == r) return app.util.message({
          //     title: "请填写汽车名称",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });

          var worktime = a.detail.value.work_hours; // if ("" == worktime || "undefined" == worktime) return app.util.message({
          //     title: "请填写工作时长",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });

          var wei = a.detail.value.weight; // if ("" == wei || "undefined" == wei) return app.util.message({
          //     title: "请填写重量",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });
          // var yea = a.detail.value.agelimit;
          // if ("" == yea || "undefined" == yea) return app.util.message({
          //     title: "请填出厂年限",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });

          var gdate = t.buydate1;
          if ("" == gdate || "undefined" == gdate) return app.globalData.util.message({
            title: "请选择购买日期",
            type: "error"
          }), void t.setData({
            buttscan: !1
          }); // var o = a.detail.value.kilometre;
          // if ("" == o || "undefined" == o) return app.util.message({
          //     title: "请填写公里数",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });

          var u = a.detail.value.price;
          if ("" == u || "undefined" == u) return app.globalData.util.message({
            title: "请填写价格",
            type: "error"
          }), void t.setData({
            buttscan: !1
          });
          var d = a.detail.value.exhaust;
          if ("" == d || "undefined" == d) return app.globalData.util.message({
            title: "请填写排气量",
            type: "error"
          }), void t.setData({
            buttscan: !1
          });
          var c = t.gearboxindex; // if ("" == c || "undefined" == c) return app.util.message({
          //     title: "请选择变速箱类型",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });
          // if ("" == lab || "undefined" == lab) return app.util.message({
          //     title: "请填写联系人",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });

          var reln = a.detail.value.relname;
          if ("" == reln || "undefined" == reln) return app.globalData.util.message({
            title: "请填写联系人",
            type: "error"
          }), void t.setData({
            buttscan: !1
          });
          var l = a.detail.value.phone;
          if ("" == l || "undefined" == l) return app.globalData.util.message({
            title: "请填写联系电话，或点击电话授权",
            type: "error"
          }), void t.setData({
            buttscan: !1
          });
          var m = a.detail.value.address;
          if ("" == m || "undefined" == m) return app.globalData.util.message({
            title: "请填写车辆地址",
            type: "error"
          }), void t.setData({
            buttscan: !1
          });
          var p = t.carsimgs;
          if (p.length < 3) return app.globalData.util.message({
            title: "请至少添加3张车辆图片",
            type: "error"
          }), void t.setData({
            buttscan: !1
          });
          var g = [];

          for (var h in p) "" != p[h].imgshort && "" != p[h].img && (console.log(p[h]), console.log(p[h].imgshort), g.push(p[h]));

          var f = a.detail.value.synopsis,
              v = {
            r: "sale.index.insale",
            m: "monai_market",
            fomid: a.detail.formId,
            uid: e,
            classid: i,
            brand: s,
            exhaust: d,
            times: t.buydate1,
            times1: t.buydate1,
            kilometre: '',
            price: u,
            gearboxindex: c,
            phone: l,
            carname: r,
            address: m,
            carimgs: JSON.stringify(g),
            mapx: t.mapx,
            mapy: t.mapy,
            synopsis: f,
            relname: reln,
            // 联系人姓名
            label: '',
            has_invoice: t.has_invoice,
            has_certificate: t.has_certificate,
            // 标签
            video: t.video.url,
            // 首图视频
            buydate: t.buydate1,
            // 设备购买日期
            work_hours: worktime,
            // 工作时长
            weight: wei,
            //  重量（吨）
            // agelimit: yea,
            // // 出厂年限
            cab_worn: t.carInfo.cab_worn,
            // 驾驶室 是否有碰撞   0无 ，1轻微 ，2有
            ele_gac: t.carInfo.ele_gac,
            // 电动油门 是否正常 0是（正常）， 1否
            enginewaste_on: t.carInfo.enginewaste_on,
            // 发动机是否有废气（上排气）	0无 ，1轻微 ，2有	
            enginewaste_down: t.carInfo.enginewaste_down,
            // 发动机是否有废气（下排气）	0无 ，1轻微 ，2有	
            fallarm_b: t.carInfo.fallarm_b,
            // 掉臂情况（大臂）0无 ，1轻微 ，2有
            fallarm_s: t.carInfo.fallarm_s,
            // 掉臂情况（小臂）0无 ，1轻微 ，2有
            fallarm_c: t.carInfo.fallarm_c,
            // 掉臂情况（铲斗）0无 ，1轻微 ，2有
            tablegap_sx: t.carInfo.tablegap_sx,
            // 转盘间隙情况（上下）0无 ，1轻微 ，2有
            tablegap_zy: t.carInfo.tablegap_zy,
            // 转盘间隙情况（左右）0无 ，1轻微 ，2有
            brace_car: t.carInfo.brace_car,
            // 怠速撑车情况 0正常 ，1撑不完全 ，2撑不起
            onewalk_z: t.carInfo.onewalk_z,
            // 单边行走情况（左边）0正常 ，1慢 ，2走不动
            onewalk_y: t.carInfo.onewalk_y,
            // 单边行走情况（右边）0正常 ，1慢 ，2走不动
            walkslow_z: t.carInfo.walkslow_z,
            // 行走时减速是否有异响（左边） 0无 ， 1有
            walkslow_y: t.carInfo.walkslow_y,
            // 行走时减速是否有异响（右边） 0无 ， 1有
            idling_holdcar: t.carInfo.idling_holdcar,
            // 怠速憋车情况 0正常 ，1有烟 ，2熄火
            holdsmoke_b: t.carInfo.holdsmoke_b,
            // 憋车发动机烟量（大油门）	0正常 ，1量小 ，2量大
            holdsmoke_s: t.carInfo.holdsmoke_s,
            // 憋车发动机烟量（小油门）	0正常 ，1量小 ，2量大
            device_speed: t.carInfo.device_speed,
            // 设备速度情况  0快 ，1慢 ，2无动作
            crack_b: t.carInfo.crack_b,
            // 开裂情况（大臂） 0无 ， 1有
            crack_s: t.carInfo.crack_s,
            // 开裂情况（小臂） 0无 ， 1有
            crack_c: t.carInfo.crack_c,
            // 开裂情况（铲斗） 0无 ， 1有
            runbig_fdj: t.carInfo.runbig_fdj,
            // 设备运行大件是否有异响（发动机）	0无 ， 1有
            runbig_zf: t.carInfo.runbig_zf,
            // 设备运行大件是否有异响（主阀）		0无 ， 1有
            runbig_hzmd: t.carInfo.runbig_hzmd,
            // 设备运行大件是否有异响（回转马达）	0无 ， 1有
            chain_z: t.carInfo.chain_z,
            // 链轨链桶情况（左连接） 0无 ， 1有
            chain_y: t.carInfo.chain_y,
            // 链轨链桶情况（右连接） 0无 ， 1有
            x_frame: t.carInfo.x_frame,
            // x架情况	0正常 ，1有开裂 ，2需更换
            mace: t.carInfo.mace,
            // 锤及管路（锤） 0带 ，1需拆 ，2无
            tube: t.carInfo.tube,
            // 锤及管路（管路） 0带 ，1需拆 ，2无
            routine_fp: t.carInfo.routine_fp,
            // 手续情况（发票） 0无 ， 1有
            routine_hgz: t.carInfo.routine_hgz // 手续情况（合格证） 0无 ， 1有

          };
		  
          app.globalData.util.request({
            url: "entry/wxapp/Api",
            method: "POST",
            data: v,
            cachetime: "0",
            success: function (a) {
              a && a.data && 405 == a.data.message ? t.setData({
                isShow: !0,
                buttscan: !1
              }) : a && a.data && a.data.data && wx.showModal({
                content: "提交成功",
                cancelText: "继续添加",
                confirmText: "好的",
                success: function (a) {
                  a.confirm ? (t.cleardetail(), wx.switchTab({
                    url: "/pages/index/index"
                  })) : a.cancel && (t.setData({
                    buttscan: !1
                  }), wx.reLaunch({
                    url: "/pages/sale/index"
                  }));
                }
              });
            },
            fail: function (a) {
              t.setData({
                buttscan: !1
              });
              wx.showToast({
                title: a.data.message,
                icon: 'none'
              });
            }
          });
        } else {
          if ("" == i || "undefined" == i || "请选择车辆类型" == i) return app.globalData.util.message({
            title: "请选择车辆类型",
            type: "error"
          }), void t.setData({
            buttscan: !1
          }); // var s = t.data.brandid;

          var s = a.detail.value.car_type; // if ("" == s || "undefined" == s || "请输入车辆品牌" == s) return app.util.message({
          //     title: "请输入车辆品牌",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });

          var n = t.selecttime; // if ("请选择生产日期" == n || "undefined" == n || "" == t.data.selecttime1) return app.util.message({
          //     title: "请选择生产日期",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });

          var r = a.detail.value.carname;
          // if ("" == r || "undefined" == r) return app.globalData.util.message({
          //   title: "请填写品牌型号",
          //   type: "error"
          // }), void t.setData({
          //   buttscan: !1
          // });
          var worktime = a.detail.value.work_hours; // if ("" == worktime || "undefined" == worktime) return app.util.message({
          //     title: "请填写工作时间",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });

          var wei = a.detail.value.weight; // if ("" == wei || "undefined" == wei) return app.util.message({
          //     title: "请填写重量",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });
          // var yea = a.detail.value.agelimit;
          // if ("" == yea || "undefined" == yea) return app.util.message({
          //     title: "请填出厂年限",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });

          var gdate = t.buydate1;
          if ("" == gdate || "undefined" == gdate) return app.globalData.util.message({
            title: "请选择购买日期",
            type: "error"
          }), void t.setData({
            buttscan: !1
          }); // var o = a.detail.value.kilometre;
          // if ("" == o || "undefined" == o) return app.util.message({
          //     title: "请填写公里数",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });

          var u = a.detail.value.price;
          if ("" == u || "undefined" == u) return app.globalData.util.message({
            title: "请填写销售价钱",
            type: "error"
          }), void t.setData({
            buttscan: !1
          }); // var d = a.detail.value.exhaust;
          // if ("" == d || "undefined" == d) return app.util.message({
          //     title: "请填写排气量",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });
          // var c = t.data.gearboxindex;
          // if ("" == c || "undefined" == c) return app.util.message({
          //     title: "请选择变速箱类型",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });
          // if ("" == lab || "undefined" == lab) return app.util.message({
          //     title: "请填写联系人",
          //     type: "error"
          // }), void t.setData({
          //     buttscan: !1
          // });

          var reln = a.detail.value.relname;
          if ("" == reln || "undefined" == reln) return app.globalData.util.message({
            title: "请填写机主姓名",
            type: "error"
          }), void t.setData({
            buttscan: !1
          });
          var l = a.detail.value.phone;
          if ("" == l || "undefined" == l) return app.globalData.util.message({
            title: "请填写联系电话，或点击电话授权",
            type: "error"
          }), void t.setData({
            buttscan: !1
          });
          var m = a.detail.value.address;
          if ("" == m || "undefined" == m) return app.globalData.util.message({
            title: "请填写车辆地址",
            type: "error"
          }), void t.setData({
            buttscan: !1
          });
          var p = t.carsimgs;
          if (p.length < 3) return app.globalData.util.message({
            title: "请至少添加3张车辆图片",
            type: "error"
          }), void t.setData({
            buttscan: !1
          });
          var g = [];

          for (var h in p) "" != p[h].imgshort && "" != p[h].img && (console.log(p[h]), console.log(p[h].imgshort), g.push(p[h]));

          var f = a.detail.value.synopsis,
              v = {
            r: "sale.index.insale",
            m: "monai_market",
            fomid: a.detail.formId,
            uid: e,
            classid: i,
            brand: s,
            exhaust: d,
            times: n,
            times1: t.buydate,
            kilometre: '',
            price: u,
            gearboxindex: c,
            phone: l,
            carname: r,
            address: m,
            carimgs: JSON.stringify(g),
            mapx: t.mapx,
            mapy: t.mapy,
            synopsis: f,
            relname: reln,
            // 联系人姓名
            label: '',
            has_invoice: t.has_invoice,
            has_certificate: t.has_certificate,
            // 标签
            video: t.video.url,
            // 首图视频
            buydate: t.buydate1,
            // 设备购买日期
            work_hours: worktime,
            // 工作时长
            weight: wei,
            //  重量（吨）
            // agelimit: yea,
            // // 出厂年限
            cab_worn: t.carInfo.cab_worn,
            // 驾驶室 是否有碰撞   0无 ，1轻微 ，2有
            ele_gac: t.carInfo.ele_gac,
            // 电动油门 是否正常 0是（正常）， 1否
            enginewaste_on: t.carInfo.enginewaste_on,
            // 发动机是否有废气（上排气）	0无 ，1轻微 ，2有	
            enginewaste_down: t.carInfo.enginewaste_down,
            // 发动机是否有废气（下排气）	0无 ，1轻微 ，2有	
            fallarm_b: t.carInfo.fallarm_b,
            // 掉臂情况（大臂）0无 ，1轻微 ，2有
            fallarm_s: t.carInfo.fallarm_s,
            // 掉臂情况（小臂）0无 ，1轻微 ，2有
            fallarm_c: t.carInfo.fallarm_c,
            // 掉臂情况（铲斗）0无 ，1轻微 ，2有
            tablegap_sx: t.carInfo.tablegap_sx,
            // 转盘间隙情况（上下）0无 ，1轻微 ，2有
            tablegap_zy: t.carInfo.tablegap_zy,
            // 转盘间隙情况（左右）0无 ，1轻微 ，2有
            brace_car: t.carInfo.brace_car,
            // 怠速撑车情况 0正常 ，1撑不完全 ，2撑不起
            onewalk_z: t.carInfo.onewalk_z,
            // 单边行走情况（左边）0正常 ，1慢 ，2走不动
            onewalk_y: t.carInfo.onewalk_y,
            // 单边行走情况（右边）0正常 ，1慢 ，2走不动
            walkslow_z: t.carInfo.walkslow_z,
            // 行走时减速是否有异响（左边） 0无 ， 1有
            walkslow_y: t.carInfo.walkslow_y,
            // 行走时减速是否有异响（右边） 0无 ， 1有
            idling_holdcar: t.carInfo.idling_holdcar,
            // 怠速憋车情况 0正常 ，1有烟 ，2熄火
            holdsmoke_b: t.carInfo.holdsmoke_b,
            // 憋车发动机烟量（大油门）	0正常 ，1量小 ，2量大
            holdsmoke_s: t.carInfo.holdsmoke_s,
            // 憋车发动机烟量（小油门）	0正常 ，1量小 ，2量大
            device_speed: t.carInfo.device_speed,
            // 设备速度情况  0快 ，1慢 ，2无动作
            crack_b: t.carInfo.crack_b,
            // 开裂情况（大臂） 0无 ， 1有
            crack_s: t.carInfo.crack_s,
            // 开裂情况（小臂） 0无 ， 1有
            crack_c: t.carInfo.crack_c,
            // 开裂情况（铲斗） 0无 ， 1有
            runbig_fdj: t.carInfo.runbig_fdj,
            // 设备运行大件是否有异响（发动机）	0无 ， 1有
            runbig_zf: t.carInfo.runbig_zf,
            // 设备运行大件是否有异响（主阀）		0无 ， 1有
            runbig_hzmd: t.carInfo.runbig_hzmd,
            // 设备运行大件是否有异响（回转马达）	0无 ， 1有
            chain_z: t.carInfo.chain_z,
            // 链轨链桶情况（左连接） 0无 ， 1有
            chain_y: t.carInfo.chain_y,
            // 链轨链桶情况（右连接） 0无 ， 1有
            x_frame: t.carInfo.x_frame,
            // x架情况	0正常 ，1有开裂 ，2需更换
            mace: t.carInfo.mace,
            // 锤及管路（锤） 0带 ，1需拆 ，2无
            tube: t.carInfo.tube,
            // 锤及管路（管路） 0带 ，1需拆 ，2无
            routine_fp: t.carInfo.routine_fp,
            // 手续情况（发票） 0无 ， 1有
            routine_hgz: t.carInfo.routine_hgz // 手续情况（合格证） 0无 ， 1有

          };
          app.globalData.util.request({
            url: "entry/wxapp/Api",
            method: "POST",
            data: v,
            cachetime: "0",
            success: function (a) {
              a && a.data && 405 == a.data.message ? t.setData({
                isShow: !0,
                buttscan: !1
              }) : a && a.data && a.data.data && wx.showModal({
                content: "提交成功",
                cancelText: "继续添加",
                confirmText: "好的",
                success: function (a) {
                  a.confirm ? (t.cleardetail(), wx.switchTab({
                    url: "/pages/index/index"
                  })) : a.cancel && (t.setData({
                    buttscan: !1
                  }), wx.reLaunch({
                    url: "/pages/sale/index"
                  }));
                }
              });
            },
            fail: function (a) {
              t.setData({
                buttscan: !1
              });
              wx.showToast({
                title: a.data.message,
                icon: 'none'
              });
            }
          });
        }
      } else t.setData({
        isShow: !0
      });
    },
    cleardetail: function () {
      this.setData({
        selectclass: "请选择分类",
        selectbrand: "请选择品牌",
        selecttime: " 请选择生产日期",
        selecttime1: "",
        buydate: '请选择购买日期',
        buydate1: '',
        vehicletime1: "",
        insurance1: "",
        gearboxname: "请选择变速箱类型",
        gearboxindex: 0,
        mapx: "",
        mapy: "",
        carimgs: [],
        textareaname: "请输入车辆信息介绍",
        textareainput: "",
        carsimgs: [{
          img: "",
          intro: "",
          imgshort: ""
        }],
        brandid: "",
        brandname: "",
        classid: "",
        defult_value: ""
      });
    },
    upnotice: function (a) {
      this.noticeindex = a.detail.current;
    },
    retonotice: function () {
      var a = this.notice[this.noticeindex];
      a && a.id && wx.navigateTo({
        url: "/pages/index/index?id=" + a.id
      });
    },
    delcarsimgs: function (a) {
      var t = a.currentTarget.dataset.index,
          e = this.carsimgs;
      if (0 == t && 1 < e.length && ("" != e[t].img || "" != e[t].intro)) return "" != e[t].img && app.globalData.util.request({
        url: "entry/wxapp/Api",
        data: {
          m: "monai_market",
          uid: app.globalData.getuid(),
          imgurl: e[t].img,
          r: "Upimg.delImg"
        }
      }), e.splice(t, 1), void this.setData({
        carsimgs: e
      });
      0 != t && ("" != e[t].img && app.globalData.util.request({
        url: "entry/wxapp/Api",
        data: {
          m: "monai_market",
          uid: app.globalData.getuid(),
          imgurl: e[t].img,
          r: "Upimg.delImg"
        }
      }), e.splice(t, 1), this.setData({
        carsimgs: e
      }));
    },
    upcarsimgs: function (a) {
      var e = this; // 9 <= e.data.carsimgs.length ? app.util.message({
      //     title: "您添加的图片已经很多了",
      //     type: "error"
      // }) : 

      app.globalData.upimgs({
        scannums: 9,
        filename: "cars",
        success: function (a) {
          for (var t in a) {
            if (e.carsimgs.length <= 50) {
              e.addinimgs(a[t]);
            } else {
              app.globalData.util.message({
                title: "您添加的图片已经很多了",
                type: "error"
              });
              return;
            }
          }

          ;
        }
      });
    },
    addinimgs: function (a) {
      var t = this.carsimgs,
          e = {
        img: a.all,
        imgshort: a.short
      };
      t.push(e), this.setData({
        carsimgs: t
      });
    },
    showimgs: function (a) {
      var t = a.currentTarget.dataset.index,
          e = this.carsimgs;
      wx.previewImage({
        current: e[t].img,
        urls: [e[t].img]
      });
    },
    upthiscarsimgs: function (a) {
      var t = a.currentTarget.dataset.index,
          e = this.carsimgs;
      app.globalData.util.request({
        url: "entry/wxapp/Api",
        data: {
          m: "monai_market",
          uid: app.globalData.getuid(),
          imgurl: e[t].img,
          r: "Upimg.delImg"
        }
      }), e[t].img = "", this.setData({
        carsimgs: e
      });
    },
    setthisintro: function (a) {
      var t = a.currentTarget.dataset.index;
      this.carsimgs[t].intro = a.detail.value;
    },
    addcarsimgs: function () {
      var a = this.carsimgs;
      a.push({
        img: "",
        intro: "",
        imgshort: ""
      }), this.setData({
        carsimgs: a
      });
    },
    upimg: function () {
      var e = this,
          i = e.carimgs;
      if (9 <= i.length) app.globalData.util.message({
        title: "您上传的图片已经很多了",
        type: "error"
      });else {
        i.length;
        app.globalData.upimgs({
          scannums: 1,
          filename: "cars",
          success: function (a) {
            var t = i.concat(a);
            e.setData({
              carimgs: t
            });
          }
        });
      }
    },
    delimg: function (a) {
      console.log(a.currentTarget.dataset.index);
      var t = a.currentTarget.dataset.index,
          e = this.carimgs,
          i = e[t].all;
      app.globalData.util.request({
        url: "entry/wxapp/Api",
        data: {
          m: "monai_market",
          uid: app.globalData.getuid(),
          imgurl: i,
          r: "Upimg.delImg"
        }
      }), e.splice(t, 1), this.setData({
        carimgs: e
      });
    },

    formReset() {
      console.log("占位：函数 formReset 未声明");
    }

  }
};
</script>
<style>
@import "./index.css";
</style>